package com.sias.realestate.web.service.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sias.realestate.core.generic.GenericDao;
import com.sias.realestate.core.generic.GenericServiceImpl;
import com.sias.realestate.web.dao.TenementMapper;
import com.sias.realestate.web.model.Tenement;
import com.sias.realestate.web.service.TenementService;

@Service
public class TenementServiceImpl extends GenericServiceImpl<Tenement, Integer> implements TenementService{

	@Resource
	private TenementMapper tenementmapper;

	@Override
    public int insert(Tenement model) {
        return tenementmapper.insertSelective(model);
    }

    @Override
    public int update(Tenement model) {
        return tenementmapper.updateByPrimaryKeySelective(model);
    }

    @Override
    public int delete(Integer id) {
        return tenementmapper.deleteByPrimaryKey(id);
    }

    @Override
    public Tenement selectById(Integer id) {
        return tenementmapper.selectByPrimaryKey(id);
    }
    
	@Override
	public List<Tenement> selectList() {
		// TODO Auto-generated method stub		
		return tenementmapper.findAll();
	}
	@Override
	public GenericDao<Tenement, Integer> getDao() {
		// TODO Auto-generated method stub
		return tenementmapper;
	}


	@Override
	public Tenement findTenementByIdcard(String idcard) {
		// TODO Auto-generated method stub
		return tenementmapper.selectByIdcard(idcard);
	}

	@Override
	public boolean addTenement(List<Tenement> tenementList) {
		// TODO Auto-generated method stub
		try {
			tenementmapper.addList(tenementList);
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		} 
	}

	@Override
	public List<Tenement> findTenementByOidNull() {
		// TODO Auto-generated method stub
		return tenementmapper.findByNull();
	}


}
